import request from '@/utils/request'

/** *
 * 获取角色列表
 * **/
export function getRoleList(params) {
  return request({
    url: '/sys/role',
    params // 查询参数
  })
}

/** **
 * 新增角色
 * ***/

export function addRole(data) {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

/**
 * 更新角色
 * ***/

export function updateRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}

/** *
 * 删除角色
 * **/

export function delRole(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

/**
 * 获取角色详情
 * **/

export function getRoleDetail(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

/**
 * 给角色分配权限
 *
 * ***/

export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}

export function getResponseDepartment(data) {
  return request({
    url: '/response/names',
    method: 'post',
    data
  })
}

export function getResponseZipFile(id) {
  return request({
    url: `/secondment/file/${id}`,
    responseType: 'blob'
  })
}
export function getTempZipFile(id) {
  return request({
    url: `/secondment/temp/${id}`,
    responseType: 'blob'
  })
}

export function getZipName(id) {
  return request({
    url: `/secondment/zip/name/${id}`,
  })
}


export function changeSecondmentState(id) {
  return request({
    url: `/secondment/state/${id}`,
  })
}

export function changeConfirmState(data) {
  return request({
    url: '/secondment/confirm/state' ,
    method: 'post',
    data
  })
}

export function confirmTime(data) {
  return request({
    url: '/secondment/confirm/time' ,
    method: 'post',
    data
  })
}

export function dowRes(data) {
  return request({
    url: '/response/file',
    params: data,
    responseType: 'blob'
  })
}

